home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / mail / thor201.lha / THOR_2.0 / thor.lha / rexx / AddFileList.br < prev    next >
Text File  |  1995-05-15  |  2KB  |  108 lines

  1. /* AddFileList.br
  2.  *
  3.  * Arexx script to add a FLIM ABBS file list to the database.
  4.  */
  5.     options results
  6. /*    trace results */
  7.  
  8.     parse arg argument
  9.  
  10.     template = 'BBSNAME/A,FILENAME/A'
  11.  
  12.     if(argument = '' | argument = '?') then
  13.     do
  14.         say '$VER: AddFileList.br V3.5 (12.12.94)'
  15.         say 'Template:' template
  16.         exit
  17.     end
  18.  
  19.     if ~show('p', 'BBSREAD') then do
  20.         address command
  21.             "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  22.             "WaitForPort BBSREAD"
  23.     end
  24.  
  25.     address BBSREAD
  26.  
  27.     READARGS template ARGS CMDLINE argument
  28.     if(rc ~= 0) then 
  29.     do
  30.         say BBSREAD.LASTERROR
  31.         exit
  32.     end
  33.  
  34.     if(~OPEN(fh,ARGS.FILENAME,'Read')) then 
  35.     do
  36.         say 'Unable to open file'
  37.         exit
  38.     end
  39.  
  40.     rc = 0
  41.     signal on ERROR
  42.     signal on BREAK_C
  43.     signal on HALT
  44.  
  45.     BUFMODE COPYBACK        /* Enable copyback buffer mode */
  46.  
  47.     do until eof(fh)
  48.         aline = readln(fh)
  49.  
  50.         if(left(aline, 21) = 'Listing of directory ') then 
  51.         do
  52.             farea = '"' || strip(substr(aline, 22),'T',':') || '"'
  53.  
  54.             say '0A'x || '(' || strip(farea,'B', '"') || ')'
  55.  
  56.             CONFIGFAREA '"' || ARGS.BBSNAME || '"' farea 
  57.         end
  58.         else
  59.         do
  60.             aline = substr(aline,3)
  61.             parse var aline fname fdate fsize fdnls fdescr
  62.  
  63.             if(datatype(fdate,'W') & datatype(fsize,'W') & datatype(fdnls,W)) then
  64.             do
  65.                 drop CD.
  66.                 CD.MDAY  = left(fdate,2)
  67.                 CD.MONTH = substr(fdate,3,2)
  68.                 CD.YEAR  = right(fdate,2)
  69.                 if CD.YEAR < 78 then CD.YEAR = CD.YEAR + 2000
  70.                 else CD.YEAR = CD.YEAR + 1900
  71.                 
  72.                 DATE2AMIGA CD
  73.                 convfdate = result
  74.  
  75.                 say left(fname, 18) fdate right(fsize, 7) right(fdnls, 3) strip(fdescr)
  76.                 
  77.                 drop BRFILE.
  78.  
  79.                 BRFILE.NAME      = fname
  80.                 BRFILE.DATE      = convfdate
  81.                 BRFILE.SIZE      = fsize
  82.                 BRFILE.DOWNLOADS = fdnls
  83.                 
  84.                 if fdescr ~= '' then
  85.                 do
  86.                     BRFILE.DESCRIPTION.COUNT = 1
  87.                     BRFILE.DESCRIPTION.1 = strip(fdescr)
  88.                 end
  89.  
  90.                 WRITEBRFILE '"' || ARGS.BBSNAME || '"' farea stem BRFILE 
  91.  
  92.             end
  93.         end
  94.     end
  95.  
  96. ERROR:
  97. HALT:
  98. BREAK_C:
  99.  
  100.     if(rc ~= 0) then 
  101.     do
  102.         say 'Error' rc 'in line' SIGL ':' BBSREAD.LASTERROR
  103.     end
  104.  
  105.     BUFMODE ENDCOPYBACK        /* Disable copyback buffer mode */
  106.  
  107.     exit
  108.